package cn.doit.scala.day04

/**
 * @DATE 2021/12/28/9:43
 * @Author MDK
 * @Version 2021.2.2
 * */
object C04_Reduce {
  def main(args: Array[String]): Unit = {
    val list = List(1, 2, 3, 4, 5)
    val i = list.reduce(_ + _)
    println(i)

    val i1 = list.reduce((x1, x2) => x1 + x2)
    println(i1)

    val arr = Array[String]("a", "b", "c", "d", "e")
    val str = arr.reduce((x1, x2) => x1 + ":" + x2)
    println(str)

    val i2 = list.reduce(_ * _)
    println(i2)
  }
}
